package com.java.wmovie.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class MyWebConfig implements WebMvcConfigurer {
    //设置静态文件的目录

        @Override
        public void addResourceHandlers(ResourceHandlerRegistry registry) {
            //获取文件的真实路径 work_project代表项目工程名 需要更改
                registry.addResourceHandler("/static/img/upload/**").
                        addResourceLocations("file:"+System.getProperty("user.dir")+"\\src\\main\\resources\\static\\img\\upload\\");
            }
        }

